2026-09-27 · class-notes, tryhackme, http, https, url, http-methods, status-codes, cookies
Full class notes for TryHackMe module 7: HTTP/HTTPS, URL structure, requests and responses, HTTP methods, status codes, headers, and cookies.
Class notes · TryHackMe Pre Security · Module 7
Quick reference: the short version of this lesson lives in the TryHackMe resource sheets. This follows Module 6 (DNS in Detail) — DNS got you to the right server; this lesson covers what your browser actually says to that server once it arrives.
Numbering note: the update block for this lesson was labelled "SECTION/UNIT: 6", the same number as DNS in Detail. Since HTTP and DNS are clearly sequential topics within TryHackMe's web-fundamentals material, this has been filed as Module 7 rather than a duplicate 6 — flag if that's not what you intended.
By the end of these notes you should be able to:
HTTP — HyperText Transfer Protocol — is the protocol used every time you view a website. It was developed by Tim Berners-Lee and his team between 1989 and 1991. HTTP is the set of rules that governs how a browser communicates with a web server to transmit web page data: HTML, images, video, and so on.
HTTPS — HyperText Transfer Protocol Secure — is the encrypted version of HTTP. Encryption does two things at once: it stops anyone observing the traffic from reading the data being sent or received, and it gives you assurance that you are actually talking to the genuine web server rather than something impersonating it.
Before a browser can request anything, it needs to know exactly how and where to find it — that instruction is a URL (Uniform Resource Locator). A URL can carry several distinct parts, though not every request uses all of them:
| Part | Purpose | Example |
|---|---|---|
| Scheme | Which protocol to use | http, https, ftp |
| User | Username/password for services that authenticate via the URL | — |
| Host | The domain name or IP address of the server | tryhackme.com |
| Port | The port to connect to — commonly 80 for HTTP, 443 for HTTPS, but any port from 1–65535 is possible | :8080 |
| Path | The specific file or location being requested | /blog |
| Query string | Extra information passed to the path | ?id=1 |
| Fragment | A reference to a location within the page itself | #section2 |
In the real world:
/blog?id=1tells the/blogpath that the client wants the article with id 1 — the query string is how a single path can serve many different results depending on what is passed to it.
The bare minimum a request needs is one line:
GET / HTTP/1.1
But for a real browsing experience, a request typically carries several more lines of information, called headers (covered fully in Section 5). A representative request looks like this:
GET / HTTP/1.1
Host: tryhackme.com
User-Agent: Mozilla/5.0 (Firefox/87.0)
Referer: https://tryhackme.com
Reading it line by line:
GET requests the resource; / is the home
page; HTTP/1.1 states the protocol version being used.https://tryhackme.com.And the response that comes back:
HTTP/1.1 200 OK
Server: nginx/1.18.0
Date: Mon, 01 Jan 2024 12:00:00 GMT
Content-Type: text/html
Content-Length: 1256
<!DOCTYPE html>
...
HTTP/1.1 states the protocol version, followed by
the status code — here 200 OK, meaning the request succeeded
(Section 4).Note (beyond this lesson): the example
Server,DateandContent- Lengthvalues above are illustrative rather than a live capture of a real request/response pair, to make each line's purpose clear without asserting a specific site's actual current output.
A method states the client's intended action. There are several, but two dominate day-to-day use:
| Method | Purpose |
|---|---|
| GET | Retrieve information from the server |
| POST | Submit data to the server, potentially creating new records |
| PUT | Submit data to the server to update existing information |
| DELETE | Remove information/records from the server |
Every HTTP response starts with a status code in its first line, telling the client the outcome of its request — and often hinting at what to do next. Codes fall into five ranges:
| Range | Meaning |
|---|---|
| 100–199 | Informational — the first part of the request was accepted; continue sending the rest. Rarely seen today. |
| 200–299 | Success — the request completed successfully. |
| 300–399 | Redirection — the client should look elsewhere for the resource. |
| 400–499 | Client error — something was wrong with the request. |
| 500–599 | Server error — something went wrong on the server's side, usually a significant problem. |
| Code | Meaning |
|---|---|
| 200 OK | The request completed successfully. |
| 201 Created | A resource was created (e.g. a new user or post). |
| 301 Moved Permanently | The resource has moved permanently; browsers and search engines should update to the new location. |
| 302 Found | A temporary redirect — unlike 301, the resource may move back or move again. |
| 400 Bad Request | Something was wrong or missing in the request, possibly a missing expected parameter. |
| 401 Not Authorised | Authentication (commonly username/password) is required before viewing this resource. |
| 403 Forbidden | Access is denied, whether logged in or not. |
| 404 Page Not Found | The requested resource does not exist. |
| 405 Method Not Allowed | The resource does not accept the method used (e.g. sending GET to a path expecting POST). |
| 500 Internal Server Error | The server hit an error it does not know how to handle. |
| 503 Service Unavailable | The server cannot handle the request — overloaded or down for maintenance. |
Headers are extra data sent alongside a request or response. No header is strictly required to make a request work at the protocol level, but without them a website becomes very difficult to use properly.
Sent from the client (typically your browser) to the server:
Returned from the server to the client:
A cookie is a small piece of data stored on your computer. A cookie is created when the browser receives a Set-Cookie header in a response; from that point on, the browser sends that cookie's data back to the server on every subsequent request.
Cookies exist because HTTP is stateless — it has no built-in memory of your previous requests. A cookie lets the server "remember" who you are, personal settings, or whether you have visited before, despite the protocol itself having no concept of an ongoing session.
Cookies are most commonly used for website authentication. Rather than storing a plain-text password, the cookie's value is normally a token — a unique, not-easily-guessable secret code — rather than something a human could read and reuse directly.
In the real world: you can see exactly which cookies your browser is sending by opening your browser's developer tools, switching to the Network tab, selecting a request, and checking its Cookies tab.
A user logs into a website with a username and password.
POST request to /login with the
credentials in the request body.Set-Cookie header carrying an authentication token, along
with a 302 Found status redirecting to the account dashboard.GET request for the dashboard, now including a Cookie header carrying
that token.This lesson's building blocks — methods, status codes, headers, cookies — are exactly what a web attacker and a web defender both work with directly:
HttpOnly and Secure in
production systems.METHOD PATH HTTP/VERSION, plus optional
headers, and always ends with a blank line; a response starts with
HTTP/VERSION STATUS, its own headers, a blank line, then the body.Set-Cookie and returned via Cookie, give
stateless HTTP a way to remember a client across requests — commonly
used for authentication via a token.| Term | Meaning |
|---|---|
| HTTP | HyperText Transfer Protocol; rules for web communication. |
| HTTPS | HTTP Secure; encrypted, identity-verified HTTP. |
| URL | Uniform Resource Locator; an address for a web resource. |
| Scheme | The protocol part of a URL (http, https, ftp). |
| Host | The domain/IP part of a URL identifying the server. |
| Path | The specific resource location within a URL. |
| Query string | Extra parameters passed to a path in a URL. |
| Fragment | A reference to a specific location within a page. |
| HTTP method | The client's stated action (GET, POST, PUT, DELETE). |
| Status code | The three-digit outcome code in an HTTP response. |
| Header | Extra metadata sent with an HTTP request or response. |
| User-Agent | A header identifying the client's browser and version. |
| Referer | A header identifying the page that linked to this request. |
| Cookie | Small client-stored data sent back on subsequent requests. |
| Stateless | HTTP's lack of built-in memory between requests. |
| Token | A unique secret value, often used in an auth cookie. |